using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using QLNhaSach.BUS;
using QLNhaSach.BUS.DTO;

namespace QLNhaSach.GUI.NhanVienKeToan
{
    public partial class LapBaoCaoCN : Form
    {
        DataTable dt = new DataTable();
        CR1_BaoCaoCongNo report1 = new CR1_BaoCaoCongNo();
        public int manvketoan;
        public NhanVienDTO nv = new NhanVienDTO();

        public LapBaoCaoCN()
        {
            InitializeComponent();
        }

        private void buttonX1_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void tbddThang_TextChanged(object sender, EventArgs e)
        {
            
        }

        private void buttonX1_Click_1(object sender, EventArgs e)
        {
            this.Close();
        }

        private void LapBaoCaoCN_Load(object sender, EventArgs e)
        {
            dt = NhanVienKeToanBUS.HienThiTTCN(nv);
            nv.HoTen = dt.Rows[0][1].ToString();


            CrystalDecisions.Shared.TableLogOnInfo tli = new CrystalDecisions.Shared.TableLogOnInfo();
            foreach (CrystalDecisions.CrystalReports.Engine.Table tb in report1.Database.Tables)
            {
                tli = tb.LogOnInfo;
                tli.ConnectionInfo.ServerName = Application.StartupPath + "\\QLNhaSach.mdb";
                tb.ApplyLogOnInfo(tli);
            }
            crystalReportViewer1.ReportSource = report1;

            report1.Parameter_tennv.PromptText = nv.HoTen;

            //lvDSCongNo.Items.Clear();
            //for (int i = 0; i < dt.Rows.Count; i++)
            //{
            //    DataRow dr = dt.Rows[i];
            //    ListViewItem item = new ListViewItem();
            //    item.Text = dr["MaKH"].ToString();
            //    item.SubItems.Add(dr["TenKH"].ToString());
            //    item.SubItems.Add(dr["TienNoDau"].ToString());
            //    item.SubItems.Add(dr["NoPhatSinh"].ToString());
            //    item.SubItems.Add(dr["DaThanhToan"].ToString());
            //    item.SubItems.Add(dr["TienNoCuoi"].ToString());
            //    lvDSCongNo.Items.Add(item);
            //}
        }

        private void buttonX5_Click(object sender, EventArgs e)
        {
            report1.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.Excel, "E:\\Excel.xls");
            MessageBox.Show("Xuat File Thanh Cong !");

        }
    }
}